import os


# EXCEL配置		01
T01SHEETNAME = "测试脚本1"	# excel中默认的sheet页
T01FILENAME = 0		#  当前执行的文件
T01ID = 1			#  序号列
T01OBJECT = 2		#  操作对象列
T01LOCATION = 3		#  对象定位列
T01OPERATE = 4		#  操作列
T01VALUE = 5		#  值列
T01STARTROW = 2		#  开始读取行数
T01PARAMETERSHEETNAME = '参数'	#  参数sheet页
T01STARTPARAMETERROW = 2		#  开始读取行数
T01PARAMETERKEY = 0
T02PARAMETERYTYPE = 1
T01PARAMETERVALUE = 2
T01PARAMETERSTARTLOCATION = 5
T01EXTENSION = ".xlsx"			#  读取文件的扩展名
T01EXCELNAME = 0
T01EXCELSHEETNAME = 1
T01READDATAFUN = 2
T01INSTRUCTIONS = {
	"加载文件":r"cls.loadExcel('%s')",
	"功能标签":r"cls.funLabel('%s')",
}



# 浏览器操作配置	02
T02STEPTIME = 0.5
T02ENDTIME = 3
T02SHOW = True						# 是否显示浏览器
T02CURRENTBROWSER = "谷歌浏览器"		# 设置当前浏览器
T02BROWSERDRIVER = {				# 浏览器驱动
	"谷歌浏览器":"chromedriver4.exe",
	"火狐浏览器":"geckodriver.exe",
	"IE浏览器":"IEDriverServer.exe"
}
T02EXEC = {							# 文件和浏览器动作
	"打开":"Operate.get",
	"在新窗口中打开":"Operate.NewBrowserGet",
	"切换窗口到":"Operate.GoToWindow",
	"在新标签中打开":"Operate.NewTabGet",
	"切换标签到":"Operate.GoToTab",
	"等待":"Operate.wait",
	"显示":"Operate.Show",
	"关闭标签":"Operate.CloseTab",
	"关闭窗口":"Operate.QuitWindows",
	#-------------------------
	"输入":"Operate.InputWords",		# 用户动作
	"单击":"Operate.ClickMouse",
	"鼠标悬停":"Operate.move_to_O",
	"键盘录入":"",
	"断言操作":"Operate.SetValue",
	}
TO2LOCATION = {
	"class":"cls.driver.find_element_by_class_name('%s')",			# class属性
	"css":"cls.driver.find_element_by_css_selector('%s')",			# css选择器
	"id":"cls.driver.find_element_by_id('%s')",						# id属性
	"text":"cls.driver.find_element_by_link_text('%s')",			# 显示的文本连接
	"name":"cls.driver.find_element_by_name('%s')",					# name属性
	"partial":"cls.driver.find_element_by_partial_link_text('%s')",	# 包含显示的文本连接
	"tag":"cls.driver.find_element_by_tag_name('%s')",				# 标签属性
	"xpath":"cls.driver.find_element_by_xpath('%s')",				# Xpath属性
	"object":"cls.GetObject('%s')"									# 引用对象
}
T02SPLIT = "="
T02ASSERTTEXT = "TEXT"
T02ASSERTVALUE = "VALUE"
T02ASSERTEQUAL = "="
T02ASSERTSPLIT = ":"
T02ASSERTVARSTART = "[["
T02ASSERTVAREND = "]]"
T02ASSERT = {
	T02ASSERTTEXT:"text",
	T02ASSERTVALUE:"value",
	T02ASSERTEQUAL:"=",
	T02ASSERTSPLIT:":",
	T02ASSERTVARSTART:"[[",
	T02ASSERTVAREND:"]]",
}



# Jinja2的相关配置		03
T03SPLIT_FILED = r"]]][[["
T03SPLIT_ROW = r">>><<<"


# 和报告配置相关			04
T04PASSPRINTINFORMATION = "<div style='color:green'>%s</div>"
T04FAILEPRINTINFORMATION = "<div style='color:red'>%s</div>"


# JavaScript脚本配置		98
T98NEWTAB = '''window.open("%s");'''		# 打开新窗口

# 文件配置		99
T99SCRIPT = os.path.join(os.getcwd(),"AutoTesting","Script")
T99DRIVER = os.path.join(os.getcwd(),"AutoTesting","Resources",T02BROWSERDRIVER[T02CURRENTBROWSER])
T99REPORT = os.path.join(os.getcwd(),"AutoTesting","Report")
T99RUNFILE = os.path.join(T99SCRIPT,"Run.xlsx")		# 脚本启动文件
